<ion-header>
    <ion-toolbar>
        <ion-buttons slot="start">
            <ion-back-button [text]="'core.back' | translate" />
        </ion-buttons>
        <ion-title>
            <h1>{{ 'core.grades.grades' | translate }}</h1>
        </ion-title>
    </ion-toolbar>
</ion-header>
<ion-content>
    <core-split-view>
        <ion-refresher slot="fixed" [disabled]="!courses.loaded" (ionRefresh)="refreshCourses($event.target)">
            <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}" />
        </ion-refresher>
        <core-loading [hideUntil]="courses.loaded">
            <core-empty-box *ngIf="courses.empty" icon="fas-chart-bar" [message]="'core.grades.nogradesreturned' | translate" />

            <ion-list *ngIf="!courses.empty">
                <ion-item *ngFor="let course of courses.items" [attr.aria-label]="course.courseFullName"
                    [attr.aria-current]="courses.getItemAriaCurrent(course)" class="ion-text-wrap" button [detail]="true"
                    (click)="courses.select(course)">
                    <ion-label>
                        <p class="item-heading">
                            <core-format-text [text]="course.courseFullName" [contextInstanceId]="course.courseid" contextLevel="course" />
                        </p>
                    </ion-label>
                    <ion-badge slot="end" color="light">
                        <span class="sr-only" *ngIf="course.grade && course.grade !== '-'">
                            {{ 'core.grades.grade' | translate }}
                        </span>
                        {{course.grade}}
                    </ion-badge>
                </ion-item>
            </ion-list>
        </core-loading>
    </core-split-view>
</ion-content>
